Carbon


SPBOpenDevice

Header: Sound.h Carbon status: Supported

Opens a sound input device.

OSErr SPBOpenDevice (
    ConstStr255Param deviceName, 
    SInt16 permission, 
    SInt32 *inRefNum
);
Parameter descriptions
deviceName

The name of the sound input device to open, or the empty string if the default sound input device is to be opened.

permission

A flag that indicates whether subsequent operations with that device are to be read/write or read-only.

inRefNum

On exit, if the function is successful, a device reference number for the open sound input device.

function result

A result code.

DISCUSSION

The SPBOpenDevice function attempts to open a sound input device having the name indicated by the deviceName parameter. If SPBOpenDevice succeeds, it returns a device reference number in the inRefNum parameter. The permission parameter indicates whether subsequent operations with that device are to be read/write or read-only. If the device is not already in use, read/write permission is granted; otherwise, only read-only operations are allowed. To make any recording requests or to call the SPBSetDeviceInfo function, read/write permission must be available. Use the siReadPermission and siWritePermission constants to request the appropriate permission. See “Sound Input Device and Sound Component Information Selectors”.

You can request that the current default sound input device be opened by passing either a zero-length string or a NULL string as the deviceName parameter. If only one sound input device is installed, that device is used. Generally you should open the default device unless you specifically want to use some other device. You can get a list of the available devices by calling the SPBGetIndexedDevice function.

You must open a device before you can record from it by using SPBRecord, but the Sound Input Manager’s high-level functions automatically open the default sound input device.

SPECIAL CONSIDERATIONS

Because the SPBOpenDevice function allocates memory, you should not call it at interrupt time.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)